package com.glsc.ngateway.common.base.repo.mysql.gateway.platform;

import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.TInterfaceAccessHistoryTable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;


@Repository
public interface TInterfaceAccessHistoryTableRepository extends JpaRepository<TInterfaceAccessHistoryTable, Long> {

    @Query(value = "select count(1) as count from t_interface_access_history_table v where v.interface_name like :module% and if ( :beginDate is not null, v.access_time >= :beginDate , 1 = 1) and if ( :endDate is not null, v.access_time <= :endDate , 1 = 1) ", nativeQuery = true)
    Integer statModuleByDate(String module, String beginDate, String endDate);

    @Query(value = "select count(1) as count from t_interface_access_history_table v where v.interface_name not like 'flowable%' and v.interface_name not like 'ehr%' and if ( :beginDate is not null, v.access_time >= :beginDate , 1 = 1) and if ( :endDate is not null, v.access_time <= :endDate , 1 = 1) ", nativeQuery = true)
    Integer statOAByDate(String beginDate, String endDate);
}
